package one.stand.controller;

import one.stand.model.ResultModel;
import one.stand.request.CompanyRequest;
import one.stand.request.VersionRequest;
import one.stand.response.VersionResponse;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

/**
 * @author Administrator
 */
@RestController
@RequestMapping("company")
public class CompanyController extends BaseController {

    /**
     * 审核公司
     *
     * @param request
     * @return
     */
    @PostMapping("auditCompany")
    public ResultModel auditCompany(@RequestBody CompanyRequest request) {
        return companyService.auditCompany(request);
    }

    /**
     * 设置企业代理权限和代理价格
     *
     * @param request
     * @return
     */
    @PostMapping("configureAgen")
    public ResultModel<Boolean> configureAgen(@RequestBody CompanyRequest request) {
        return companyService.configureAgen(request);
    }

    /**
     * 小程序代码管理
     *
     * @param request
     * @return
     */
    @PostMapping("appletCodeManageList")
    public ResultModel<Map<String, Object>> appletCodeManageList(@RequestBody VersionRequest request) {
        return companyService.appletCodeManage(request);
    }

    /**
     * 小程序代码管理详情
     *
     * @param request
     * @return
     */
    @PostMapping("appletCodeManageInfo")
    public ResultModel<VersionResponse> appletCodeManageInfo(@RequestBody VersionRequest request) {
        return companyService.appletCodeManageInfo(request);
    }

    /**
     * 添加版本号
     *
     * @param request
     * @return
     */
    @PostMapping("addVersionInfo")
    public ResultModel<Boolean> addVersionInfo(@RequestBody VersionRequest request) {
        return companyService.addVersionInfo(request);
    }

    /**
     * 查询appid列表
     *
     * @return
     */
    @PostMapping("selectAppId")
    public ResultModel<List<String>> selectAppId(@RequestParam Integer versionId) {
        return companyService.selectAppId(versionId);
    }
}
